﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;

namespace RayGraphComponent
{
    /// <summary>
    /// Interpret input data to Point objects for rendering
    /// </summary>
    static class DataInterpreter
    {
        /// <summary>
        /// Convert a text to a usable data format
        /// </summary>
        /// <param name="text">string of [x , y][x , y]</param>
        /// <returns>List of usable data</returns>
        public static List<Point> TextToPointList(string input)
        {
            List<Point> list = new List<Point>();

            throw new NotImplementedException();

            // TODO: TextToPointList

            return list;
        }

        /// <summary>
        /// Convert double array [y] to a usable data format
        /// </summary>
        /// <param name="text">double array</param>
        /// <returns>List of usable data</returns>
        public static List<Point> SingleDoubleArrayToPointList(double[] input)
        {
            List<Point> list = new List<Point>();

            for (int i = 0; i < input.Length; i++)
            {
                Point p = new Point(i, input[i]);
                list.Add(p);
            }

            return list;
        }

        /// <summary>
        /// Convert double array [x, y] to a usable data format
        /// </summary>
        /// <param name="text">double array</param>
        /// <returns>List of usable data</returns>
        public static List<Point> DoubleDoubleArrayToPointList(double[][] input)
        {
            List<Point> list = new List<Point>();

            foreach (double[] d in input)
            {
                Point p = new Point(d[0], d[1]);
                list.Add(p);
            }

            return list;
        }
    }
}
